import java.util.Scanner;
public class Guest {
    String name;
    int age;
    public void selfIntro() {
        System.out.println("我叫" + name + ",今年" + age + "岁了");
    }
    public void pay() {
        selfIntro();
        if (age < 14 || age > 70) {
            System.out.println(name + "年龄是" + age + "，免票进入");
        } else {
            System.out.println(name + "年龄是" + age + ",票价是80元");
        }
    }
    public void search(){
        int count=1;
        Scanner in=new Scanner(System.in);
        String nam[]=new String[30];
        for(;;count++){
            System.out.println("请输入客户姓名：");
            nam[count]=in.next();
            if(nam[count].equals("end"))
                break;
            count++;
        }
        System.out.println("请输入下一步操作(1.查询指定位置客户姓名；2.查询全部客户；)：");
        int s=in.nextInt();
        if(s==1)
        {
            System.out.println("请输入需要查询的位置：");
            int g=in.nextInt();
            System.out.println(nam[g]);
        }
        else if(s==2){
            int d;
            for(d=0;d<count;d++)
            {
                System.out.println(nam[d]);
            }
        }
        else
        {
            System.out.println("指令不合法。");
        }
    }
}
